<?php
/**
 *  💡 免责声明：本软件不得用于商业用途，仅做学习交流
 *  ⚠️ 权利声明：本软件由版权人提供产品技术支持
 *  📅 项目编号：NX2025-0135
 */
namespace App\Service;

use Illuminate\Support\Facades\Log;

class BaseService
{
    protected $log_channel = 'daily';

    /**
     * @param ...$args
     * @return $this
     */
    public static function make(...$args): BaseService
    {
        return new static(...$args);
    }

    public function ExitResponse($msg, $code = 500)
    {
        header('Content-type:application/json');
        header('Access-control-allow-origin:*');
        exit(responses($msg, $code)->content());
    }

    protected function Log($exception, $logTitle)
    {
        Log::channel($this->log_channel)->error($logTitle, [
            //            'open_id' => $this->openid,
            'message' => $exception->getMessage(),
            'date' => now(),
        ]);
    }
}
